#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableHeroBreachDao:DaoBase<TableHeroBreach>
    {
        public override string GetFileName()
        {
            return "TableHeroBreach.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableHeroBreach>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddTwoIndex(TableHeroBreach model)
        {
            string key = GetUnionKey(model.HeroId.ToString(),model.BreachLevel.ToString());
            if (!cacheTwoIndex.ContainsKey(key))
            {
                cacheTwoIndex[key] = new List<TableHeroBreach>();
            }
            cacheTwoIndex[key].Add(model);
        }
        public override void AddPrimaryIndex(TableHeroBreach model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.HeroBreachId)) UnityEngine.Debug.LogError("数据表id重复:TableHeroBreach->id: " + model.HeroBreachId);
            #endif
            cachePrimaryInt[model.HeroBreachId] = model;
        }
        protected override TableHeroBreach ParseRowData(string[] rowData)
        {
            TableHeroBreach data = new TableHeroBreach();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.HeroBreachId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.HeroId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.BreachLevel = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.passiveLimit = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.BreachCost = string.Intern(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.atk = double.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.def = double.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.hp = double.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.speed = double.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.cri = double.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.anticri = double.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.hit = double.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.dodge = double.Parse(rowData[12]);
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.attributeAddProp = rowData[13];
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.defEvaluate = int.Parse(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.hpEvaluate = int.Parse(rowData[15]);
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.speedEvaluate = int.Parse(rowData[16]);
            }
            if (!string.IsNullOrEmpty(rowData[17]))
            {
                data.criEvaluate = int.Parse(rowData[17]);
            }
            if (!string.IsNullOrEmpty(rowData[18]))
            {
                data.anticriEvaluate = int.Parse(rowData[18]);
            }
            if (!string.IsNullOrEmpty(rowData[19]))
            {
                data.hitEvaluate = int.Parse(rowData[19]);
            }
            if (!string.IsNullOrEmpty(rowData[20]))
            {
                data.dodgeEvaluate = int.Parse(rowData[20]);
            }
            if (!string.IsNullOrEmpty(rowData[21]))
            {
                data.atkEvaluate = int.Parse(rowData[21]);
            }
            return data;
        }
    }
}
